package com.tengju.settlement.infrastructure.repository;

import com.tengju.settlement.domain.model.GuideStatusRepository;
import com.tengju.settlement.domain.model.account.UserIdCode;
import com.tengju.settlement.infrastructure.persistence.redis.GuideStatusCacheRepository;
import com.tengju.settlement.infrastructure.persistence.redis.dataobject.RedisKeyObject;
import com.tengju.settlement.infrastructure.persistence.redis.dataobject.RedisKeyPrefix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class GuideStatusRepositoryImpl implements GuideStatusRepository {

    @Autowired
    private GuideStatusCacheRepository guideStatusCacheRepository;

    @Override
    public boolean setGuideStatus(UserIdCode userIdCode) {
        RedisKeyObject redisKeyObject = new RedisKeyObject(RedisKeyPrefix.SERVICE_FEE_GUIDE, userIdCode.getValue() + "");
        return guideStatusCacheRepository.setGuideStatus(redisKeyObject,userIdCode.getValue());
    }
}
